package com.car.controller;

import com.car.entity.Image;
import com.car.entity.User;
import com.car.service.ImageService;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class ImageController  {
	
	@Autowired
	ImageService imageService;
	/**
	 * 个人中心
	    * @Title: personInfos
	    * @Description: TODO(这里用一句话描述这个方法的作用)
	    * @param @return    参数
	    * @return String    返回类型
	    * @throws
	 */
	@RequestMapping({"/personInfos",""})
	public String personInfoins(HttpSession session,Model model){
		User user = (User) session.getAttribute("loginSuccess");
		
		if(user==null){
			model.addAttribute("error", "1");
		}else{
			
			Integer nums = user.getIdCardImage();
			if(nums==null){
				model.addAttribute("judge", user.getIdCardImage());
			}else{
				model.addAttribute("judge", user.getIdCardImage());
				List<Image> list = imageService.selectToUserimgId(nums);
				model.addAttribute("imageList", list);
			}
		
		
		}
		return "H5phone/personInfo";
	}
	
	@RequestMapping("/testinfo")
	public User peridsdsd(HttpSession session){
		User user = (User) session.getAttribute("loginSuccess");
		return user;
	}

}